package me.zhengjie.tools.service

import me.zhengjie.tools.domain.EmailConfig
import me.zhengjie.tools.domain.vo.EmailVo
import org.springframework.scheduling.annotation.Async


/**
 * @author Kuki Wu
 * @date 2018-12-26
 */
interface EmailService {
    /**
     * 更新邮件配置
     * @param emailConfig 邮件配置
     * @param old 旧的配置
     * @return EmailConfig
     */
    fun update(emailConfig: EmailConfig, old: EmailConfig?): EmailConfig

    /**
     * 查询配置
     * @return EmailConfig 邮件配置
     */
    fun find(): EmailConfig?

    /**
     * 发送邮件
     * @param emailVo 邮件发送的内容
     * @param emailConfig 邮件配置
     * @throws Exception /
     */
    @Async
    @Throws(Exception::class)
    fun send(emailVo: EmailVo?, emailConfig: EmailConfig?)
}